import time


import allure
from selenium.webdriver.common.by import By
from base.webkeys import WebKeys
from locator.allPages_data import *


class Customer_detailsPage(WebKeys):
    def customer(self):
        with allure.step("点击客户tab"):
            self.on_click(*the_Customer_tab)
        with allure.step('穿透“李四"至客户详情页'):
            with allure.step('点击李四'):
                locator = ("xpath", "//*[text()='李四']")
                self.locator_with_wait(*locator).click()


    def customer_details1(self):
        # 断言
        with allure.step("判断近三个月变动趋势显示在页面"):
            locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[4]/div[3]/div[1]/div[1]')
            result=self.get_text(*locator)
        return result

    def customer_details2(self):
        with allure.step('进入交易历史详情页'):
            with allure.step('点击交易历史'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[3]/div/div/div/div[2]/div')
                self.locator_with_wait(*locator).click()
        # 断言
        with allure.step("判断近6月交易历史可以正常加载"):
            locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[4]/div[1]/div[1]')
            result=self.get_text(*locator)
        return result

    def customer_details3(self):
        with allure.step('进入转账记录详情页'):
            with allure.step('点击转账记录'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[3]/div/div/div/div[3]/div')
                self.locator_with_wait(*locator).click()
        # 断言
        with allure.step("判断转账明细可以正常加载"):
            locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[4]/div[2]/div[1]/div')
            result=self.get_text(*locator)
        return result

    def customer_details4(self):
        with allure.step('进入客户信息详情页'):
            with allure.step('点击客户信息'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[3]/div/div/div/div[4]/div')
                self.locator_with_wait(*locator).click()
        # 断言
        with allure.step("判断银行卡号可以正常加载"):
            locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[4]/div[2]/div[2]/div[2]/div[2]')
            result=self.get_text(*locator)
        return result

    def customer_details5(self):
        with allure.step('查看实际手续费'):
            with allure.step('点击查看'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[2]/div[1]/div[1]')
                self.locator_with_wait(*locator).click()
        with allure.step('按期货、郑州商品交易所查看实际手续费'):
            with allure.step('点击品种类型'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[1]/div/div[1]/div/div/div/div[2]/div')
                self.locator_with_wait(*locator).click()
            with allure.step('选择期货类型'):
                locator = ("xpath", '/html/body/div[3]/div/div[2]/div[1]')
                self.locator_with_wait(*locator).click()
            with allure.step('点击交易所'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[1]/div/div[2]/div/div/div/div[2]/div')
                self.locator_with_wait(*locator).click()
            with allure.step('选择郑州商品交易所'):
                locator = ("xpath", '/html/body/div[4]/div/div[3]/div[1]')
                self.locator_with_wait(*locator).click()
        # 断言
        with allure.step("判断手续费列表可以正常加载"):
            locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[2]/div/table/tbody/tr[1]/td[2]/div')
            result=self.get_text(*locator)
        return result

    def customer_details6(self):
        with allure.step('查看线下标签'):
            with allure.step('点击查看'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[2]/div[2]/div[2]/div[2]')
                self.locator_with_wait(*locator).click()
        # 断言
        with allure.step("判断交流方式偏好可以正常加载"):
            locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[11]/div[2]/div/div/div')
            result=self.get_text(*locator)
        return result

    def customer_details7(self):
        with allure.step('查看商机'):
            with allure.step('点击查看'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[2]/div[3]/div[2]/div[2]')
                self.locator_with_wait(*locator).click()
        # 断言
        with allure.step("判断总资产可以正常加载"):
            locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[1]/div[3]/div[1]/div[1]')
            result=self.get_text(*locator)
        return result

    def customer_details8(self):
        with allure.step('查看服务记录'):
            with allure.step('点击查看'):
                locator = ("xpath", '//*[@id="__nuxt"]/div/div/div[1]/div/div[2]/div[4]/div[2]/div[2]/i')
                self.locator_with_wait(*locator).click()
        # 断言
        with allure.step("判断触达客户策略可以正常加载"):
            locator = ("xpath"," //*[text()='触达客户策略']")
            result=self.get_text(*locator)
        return result